#ifndef __AHCOMPUTE_BRICK_H__
#define __AHCOMPUTE_BRICK_H__

#include <functional>
#include <vector>
#include <memory>

namespace ah_compute
{

template <typename DEVICE_> struct Brick
{
private:
  bool m_ready{false};

  std::vector<std::shared_ptr<Brick>> m_dependencies = {};

public:
  struct Params
  {
    
  }

  typedef OP_ Op;
  typedef DATA_ Data;

  std::static_assert(std::is_same<OP_, std::function<void(DATA_&)>>::value,
    "OP_ must be a function<void(DATA_&)>");

  Brick(Data& data) : m_data(data) {}

  bool Ready() const {
    for (auto& func: m_dependencies) {
      if (!func->ready()) {
        return false;
      }
    }
    return true;
  }

  void operator()() const
  {
    Op(m_data);
    m_ready = true;
  }
};

} // namespace ah_compute

#endif // __AHCOMPUTE__BRICK_H__